// 入口文件
const express = require('express')
// 引入数据库
const db = require('./db/connection')
const path = require('path')
const app = express()
// 设置post请求数据的处理
var bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({extended: false}))
app.use(bodyParser.json())
// 设置图片的代理路径
app.use('/public', express.static(path.join(__dirname, './static')))
// 路由配置，引入写好的路由
const useRouter = require('./router/userRouter')
const foodRouter = require('./router/foodRouter')
const phoneRouter = require('./router/foodRouter')
const imgRouter = require('./router/imgRouter')
app.use('/', useRouter)
app.use('/food', foodRouter)
app.use('/phone', phoneRouter)
app.use('/file', imgRouter)
app.listen('3000', () => {
  console.log('start start!!')
})
